home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / etc / init.d / mountkernfs.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  2009-03-31  |  2.3 KB  |  96 lines

  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          mountkernfs
  4. # Required-Start:
  5. # Required-Stop:
  6. # Should-Start:      glibc
  7. # Default-Start:     S
  8. # Default-Stop:
  9. # Short-Description: Mount kernel virtual file systems.
  10. # Description:       Mount initial set of virtual filesystems the kernel
  11. #                    provides and that are required by everything.
  12. ### END INIT INFO
  13.  
  14. PATH=/lib/init:/sbin:/bin
  15. . /lib/init/vars.sh
  16.  
  17. . /lib/lsb/init-functions
  18. . /lib/init/mount-functions.sh
  19.  
  20. [ -f /etc/default/tmpfs ] && . /etc/default/tmpfs
  21.  
  22. do_start () {
  23.     #
  24.     # Get some writable area available before the root is checked
  25.     # and remounted.
  26.     #
  27.     RW_OPT=
  28.     [ "${RW_SIZE:=$TMPFS_SIZE}" ] && RW_OPT=",size=$RW_SIZE"
  29.     domount tmpfs "" /lib/init/rw tmpfs -omode=0755,nosuid$RW_OPT
  30.     touch /lib/init/rw/.ramfs
  31.  
  32.     # Make pidfile omit directory for sendsigs
  33.     mkdir /lib/init/rw/sendsigs.omit.d/
  34.  
  35.     #
  36.     # Mount proc filesystem on /proc
  37.     #
  38.     domount proc "" /proc proc -onodev,noexec,nosuid
  39.  
  40.     #
  41.     # Mount sysfs on /sys
  42.     #
  43.     # Only mount sysfs if it is supported (kernel >= 2.6)
  44.     if grep -E -qs "sysfs\$" /proc/filesystems
  45.     then
  46.         domount sysfs "" /sys sysfs -onodev,noexec,nosuid
  47.         domount fusectl "" /sys/fs/fuse/connections fusectl
  48.     fi
  49.  
  50.     # Mount /var/run and /var/lock as tmpfs if enabled
  51.     if [ yes = "$RAMRUN" ] ; then
  52.         RUN_OPT=
  53.         [ "${RUN_SIZE:=$TMPFS_SIZE}" ] && RUN_OPT=",size=$RUN_SIZE"
  54.         domount tmpfs "" /var/run varrun -omode=0755,nosuid$RUN_OPT
  55.         touch /var/run/.ramfs
  56.     fi
  57.     if [ yes = "$RAMLOCK" ] ; then
  58.         LOCK_OPT=
  59.         [ "${LOCK_SIZE:=$TMPFS_SIZE}" ] && LOCK_OPT=",size=$LOCK_SIZE"
  60.         domount tmpfs "" /var/lock varlock -omode=1777,nodev,noexec,nosuid$LOCK_OPT
  61.         touch /var/lock/.ramfs
  62.     fi
  63.  
  64.     # Mount spufs, if Cell Broadband processor is detected
  65.     if [ -d /spu ] && grep -qs '^cpu.*Cell' /proc/cpuinfo; then
  66.             domount spufs "" /spu spufs -ogid=spu
  67.     fi
  68.  
  69.     # Propagate files from the initramfs to our new /var/run.
  70.     for file in /dev/.initramfs/varrun/*; do
  71.         [ -e "$file" ] || continue
  72.         cp -a "$file" "/var/run/${x#/dev/.initramfs/varrun/}"
  73.     done
  74. }
  75.  
  76. case "$1" in
  77.   "")
  78.     echo "Warning: mountkernfs should be called with the 'start' argument." >&2
  79.     do_start
  80.     ;;
  81.   start)
  82.     do_start
  83.     ;;
  84.   restart|reload|force-reload)
  85.     echo "Error: argument '$1' not supported" >&2
  86.     exit 3
  87.     ;;
  88.   stop)
  89.     # No-op
  90.     ;;
  91.   *)
  92.     echo "Usage: mountkernfs [start|stop]" >&2
  93.     exit 3
  94.     ;;
  95. esac
  96.